package com.huijie.app;

import org.jsets.shiro.config.EnableJsetsShiro;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * 
 * @author Administrator
 * @description 
 * 1.要修改banner，只需要在src/main/resources中添加自己的banner.txt文件
 * 2.关闭banner的功能：
 * 		SpringApplication app=new SpringApplication(Application.class);
 *      app.setShowBanner(false);(已经过时)
 *  	app.setBannerMode(Banner.Mode.OFF);
 */
@SpringBootApplication(scanBasePackages = { "com.huijie" })
@EnableScheduling
@EnableJsetsShiro
@EnableSwagger2
@ServletComponentScan
//@ComponentScan(basePackages = { "com.cn.rfid" })
public class Application extends WebMvcConfigurerAdapter {
   /** 
   * @Title: main 
   * @Description: 启动类
   * @param args
   */
	public static void main(String[] args) {
   	//showBanner是控制打印，路径为/angular/src/main/resources/banner.txt
   	//new SpringApplicationBuilder().showBanner(false).sources(Application.class).run(args);
   	SpringApplication.run(Application.class, args);
   }

	/**
	  * @param
	 * @return org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer
	 * @description: 这里也可以设置session的生命周期长度
	 * @author Alex
	 * @date 2018/12/19 17:01
	 */
	@Bean
	public EmbeddedServletContainerCustomizer containerCustomizer(){
	       return container -> {
			   //单位为S
			   container.setSessionTimeout(3000);
		   };
	}
}

